<?php
function delimg($filename) {  //删除单个图片函数
	if (is_file($filename)) {
		if (unlink($filename)) {
			return true;
		} else {
			return false;
		}
	}
}

function delallimg($path,$arr) { //删除所有的图片
	$arr = explode(',',$arr);
	foreach ($arr as $k => $v) {
		if (is_file($path.$v)) {
			unlink($path.$v);
		}
	}
	return true;
}

function deldir($dir) { //清空缓存
    $dh = opendir($dir);
    while ($file = readdir($dh)) {
        if ($file != "." && $file != "..") {
            $fullpath = $dir . "/" . $file;
            if (!is_dir($fullpath)) {
                unlink($fullpath);
            } else {
                deldir($fullpath);
            }
        }
     }
}
?>